package cate.game.train.hero.msg;

import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdBTrain;
import cate.game.role.Role;
import cate.game.role.bag.hero.Hero;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title = "英雄基础信息更新 の 返回")
public class HeroBaseUpdateResp implements MsgOutput {

    @NoteField(value = "英雄唯一ID")
    public String uid;

    @NoteField(value = "英雄模板ID")
    public int tid;

    @NoteField(value = "等级")
    public int level;

    @NoteField(value = "英雄阶数")
    public int grade;

    @NoteField(value = "共享等级")
    public int shareLevel;

    @NoteField(value = "英雄共享阶数")
    public int shareGrade;

    @NoteField(value = "英雄阶段任务状态")
    public List<Integer> starTaskList;

    public HeroBaseUpdateResp(){}

    public HeroBaseUpdateResp(Hero hero) {
        this.uid = hero.uid;
        this.tid = hero.tid;
        this.level = hero.level;
        this.grade = hero.grade;
        this.shareGrade = hero.shareGrade;
        this.shareLevel = hero.shareLevel;
        this.starTaskList = hero.starTaskList;
    }

    public static void send(Role role, Hero hero) {
        if (hero != null) {
            role.sendNow(new HeroBaseUpdateResp(hero));
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.HERO_BASE_UPDATE_RESP;
    }
}
